// 导入组件
import Vue from 'vue';
import Router from 'vue-router';
// 登录
import login from '@/views/users/login';
// 管理员首页
import index from '@/views/index';
// 用户首页
import usrIndex from '@/views/usrIndex'
/**
 * 考勤模块
 */
import record from '@/views/record/index';

/**
 * 用户模块
 */
import user from '@/views/users/index';

/**
 * 排班模块
 */
import work from '@/views/work/schedule';

/**
 * 请假模块
 */
import leave from '@/views/leave/index';
import apply from '@/views/leave/apply';

// 启用路由
Vue.use(Router);

// 导出路由 
export default new Router({
    routes: [{
        path: '/',
        name: '',
        hidden: true,
        redirect: '/login',
        meta: {
            requireAuth: false
        }
    }, {
        path: '/login',
        name: '登录',
        component: login,
        hidden: true,
        meta: {
            requireAuth: false
        }
    }, {
        path: '/admin',
        name: '管理员首页',
        component: index,
        iconCls: 'el-icon-tickets',
        meta: {
            requireAuth: true
        },
        children: [
            {
                path: '/users/index',
                name: '用户管理',
                component: user,
                meta: {
                    requireAuth: true
                }
            },
            {
                path: '/work/schedule',
                name: '发布排班信息',
                component: work,
                meta: {
                    requireAuth: true
                }
            },
            {
                path: '/leave/index',
                name: '请假审批',
                component: leave,
                meta: {
                    requireAuth: true
                }
            },
        ]
    }, {
        path: '/usr',
        name: '用户首页',
        component: usrIndex,
        iconCls: 'el-icon-tickets',
        meta: {
            requireAuth: true
        },
        children: [
            {
                path: '/record/index',
                name: '考勤打卡',
                component: record,
                meta: {
                    requireAuth: true
                }
            },
            {
                path: '/leave/apply',
                name: '请假申请',
                component: apply,
                meta: {
                    requireAuth: true
                }
            },
        ]
    }]
})